package com.behavior.observer;

import java.util.Vector;

/**
 * 抽象被观察者
 */
public abstract class Subject {

    private Vector<Observer> obs = new Vector();

    public void addObserver(Observer obs){
        this.obs.add(obs);
    }
    public void delObserver(Observer obs){
        this.obs.remove(obs);
    }
    protected void notifyObserver(String param){
        for(Observer o: obs){
            o.update(param);
        }
    }
    public abstract void doSomething(String param);

}
